/*
 * @lc app=leetcode.cn id=1051 lang=typescript
 *
 * [1051] 高度检查器
 */

// @lc code=start
function heightChecker(heights: number[]): number {
    const sorted = [...heights].sort((a, b) => a - b);
    return sorted.filter((i, index) => {
        return i !== heights[index];
    }).length;
}
// @lc code=end
